home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-22 | 4.9 KB | 172 lines | [TEXT/KAHL] |
- // This code was written Thursday June 22, 1992 by Jorg 'jbx' Brown.
- // This code is not freeware; this code is public domain.
-
- #pragma once
-
- // #undef SystemSevenOrLater
- // #define SystemSevenOrLater 1
-
- #include <Processes.h>
-
- #ifdef __APPLETALK__
- #include <Aliases.h>
- #else
- #define __APPLETALK__ // suppress unnecessary #include <AppleTalk.h>
- #include <Aliases.h>
- #undef __APPLETALK__
- #endif
-
- typedef unsigned char uchar;
- typedef unsigned short ushort;
- typedef unsigned long ulong;
-
- extern struct Keyboard {
- short wasted;
- short wasted2;
- short wasted3;
- int command : 1;
- int : 5;
- int space : 1;
- int tab : 1;
- int : 4;
- int control : 1;
- int option : 1;
- int capslock : 1;
- int shift : 1;
- } keymap : 0x174;
-
- // this structure is useful for interpreting the fdFlags field of the FInfo structure.
- typedef struct {
- int isAlias : 1;
- int isInvisible : 1;
- int hasBundle : 1;
- int nameLocked : 1;
- int isStationery: 1;
- int hasCustomIcn: 1;
- int : 1;
- int wasInited : 1;
- int hasNoINITS : 1;
- int isShared : 1;
- int SwitchLaunch: 1;
- int : 1;
- int color : 3;
- int : 1;
- } FileFlags;
-
- // theQDPort() is a quick way of getting the current port without having to
- // call GetPort.
-
- #pragma parameter __A0 theQDPort()
- pascal GrafPtr theQDPort(void) = { 0x2055, 0x2050 };
-
- // SetA4 is an inline for setting register a4 without using inline assembly.
- // it returns the old value of a4.
-
- #pragma parameter __A0 SetA4(__A0)
- pascal void *SetA4(void *newA4) = 0xC948;
-
- // CopyHandle is a better interface to HandToHand.
-
- #pragma parameter __A0 CopyHandle(__A0)
- pascal void *CopyHandle(void *) = {0xA9E1};
-
- // jbGetHandleSize is just GetHandleSize, without the error checks.
-
- #pragma parameter __D0 jbGetHandleSize(__A0)
- pascal Size jbGetHandleSize(void *h) = 0xA025;
-
- // HandleOf is a better interface to PtrToHand
-
- #pragma parameter __A0 HandleOf(__A0, __D0)
- pascal void *HandleOf(void *, long) = {0xA9E3};
-
- // ClearSpace is a trivial inline for clearing space out.
-
- #pragma parameter ClearSpace(__A0, __D0)
- pascal void ClearSpace(void *, long) = {0x4218, 0x5380, 0x66FA};
-
- // QuickMove is faster than BlockMove for very small moves.
- // (and it doesn't clear the cache)
-
- #pragma parameter QuickMove(__A0, __A1, __D0)
- pascal void QuickMove(void *from, void *to, short bytes) = {0x12D8, 0x5340, 0x66FA};
-
- // MakeALong makes a long out of two shorts efficiently.
-
- #pragma parameter __D0 MakeALong(__D0, __D1)
- pascal long MakeALong(short HiWord, short LoWord) = {0x4840, 0x3001};
-
- // MinShort takes the minimum of two input shorts efficiently
-
- #pragma parameter __D0 MinShort(__D0, __D1)
- pascal short MinShort (short a, short b) = {0xB240, 0x6E02, 0x3001};
-
- // MaxShort takes the maximum of two input shorts efficiently
-
- #pragma parameter __D0 MaxShort(__D0, __D1)
- pascal short MaxShort (short a, short b) = {0xB240, 0x6D02, 0x3001};
-
- // jbLoWord quickly retrieves the low word of a long..
-
- #define jbLoWord(l) ((short)(l))
-
- // jbHiWord quickly retrieves the high word of a long..
-
- #pragma parameter __D0 jbHiWord(__D0)
- pascal short jbHiWord(long Long) = {0x4840};
-
- // jbxDelay is a better interface for Delay.
-
- #pragma parameter __A0 jbxDelay(__A0)
- pascal long jbxDelay(long numTicks)
- = {0xA03B};
-
- // PenWhite calls PenPat(white) from QuickDraw's globals.
-
- pascal void PenWhite(void)
- = {0x2055, 0x4868, 0xFFF8, 0xA89D};
-
- // PenBlack calls PenPat(black) from QuickDraw's globals.
-
- pascal void PenBlack(void)
- = {0x2055, 0x4868, 0xFFF0, 0xA89D};
-
- // PenGray calls PenPat(gray) from QuickDraw's globals.
-
- pascal void PenGray(void)
- = {0x2055, 0x4868, 0xFFE8, 0xA89D};
-
- // ArrowCursor calls SetCursor(arrow) from QuickDraw's globals.
-
- pascal void ArrowCursor(void)
- = {0x2055, 0x4868, 0xFF94, 0xA851};
-
- // PStringMove is a quick pascal string copy using the toolbox.
-
- #pragma parameter PStringMove(__A0,__A1)
- pascal void PStringMove(const void *srcPtr,void *destPtr)
- = {0x7001, 0xD010, 0xA02E};
-
- // Why HOpenResFile isn't declared this way, I don't know.
- // (Under System 7, HORF has its own trap. MacTraps uses glue code.)
-
- pascal short HOpenResFile7(short vRefNum,long dirID,ConstStr255Param fileName,
- char permission) = 0xA81A;
-
- // a quicker inline for access to NumToString when you need it:
-
- #pragma parameter iNumToString(__D0, __A0)
- pascal void iNumToString(long theNum, void *theString) = {0x4267, 0xA9EE};
-
- // This routine, well, we all know what this routine does. Call ShowINIT(ID) to
- // show the icon with resource id ID, or call ShowINIT(0, ID) to show the icon but
- // not advance the drawing position. (i.e. call ShowINIT(0, 1), ShowINIT(0, 2),
- // ShowINIT(0, 3), ShowINIT(4) to animate startup icons.
-
- extern void ShowINIT(short iconID, ...);
-
- // DrawAnIcon draws color or black and white 32x32 icons. It takes two pointers,
- // one assumed to be pointing to the data found in a ICN# resource, the other pointing
- // to a icl4 or icl8 resource, depending on iclDepth.
-
- extern void DrawAnIcon(void *BlackAndWhiteIcon, void *ColorIcon, short iclDepth, Rect dstRect);